import time

from selenium.webdriver.chrome.webdriver import WebDriver

from model.base_page import BasePage


class BuyPage(BasePage):
    """
            用于结构化 价格总览
    """

    class Table(object):
        tBody = {}

        def __init__(self):
            pass

        # 解析购买页 的 table数据 将 table 的数据转换成字典
        def ParseTable(self, tab: WebDriver):
            trs = tab.find_elements_by_xpath("tr")
            for i in range(0, len(trs)):
                ths = tab.find_elements_by_xpath("th")
                tds = tab.find_elements_by_xpath("td")
                for i2 in range(0, len(ths)):
                    th = ths[i2]
                    td = tds[i2]
                    self.tBody[th.text] = td.text

    # 进去官网的购买页
    def EnterHighDefCloud(self):
        self.wd.get("http://test.kkclouds.com/product/gaofang_ecs/buy.html")

    # 将选择的配置和价格总览的配置进行比较
    def CheckBuyInfo(self):
        pass
